package pattern.strategy;


public class Main {

    public static void main(String[] args) {

        //简单订单对象
        ProductOrder productOrder = new ProductOrder(800,1,33);

        PromotionContext context;

        double finalPrice;


        //不同策略算出不同的活动价格

        //没活动
        context = new PromotionContext(new NormalActivity());
        finalPrice = context.executeStrategy(productOrder);
        System.out.println("NormalActivity = "+finalPrice);


        //折扣策略
        context = new PromotionContext(new DiscountActivity(0.8));
        finalPrice = context.executeStrategy(productOrder);
        System.out.println("DiscountActivity = "+finalPrice);


        //优惠券抵扣
        context = new PromotionContext(new VoucherActivity(100));
        finalPrice = context.executeStrategy(productOrder);
        System.out.println("VoucherActivity = "+finalPrice);



    }
}
